/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import client.network.NetworkEventsDispatcher;
import client.controller.events.*;
import common.model.Position;
import common.model.Visitor;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author nicolas
 * Fires differents types of events to simulate the result of the message receiver
 */
public class EventsSimulator extends Thread{

    @Override
    public void run() {
        try {
            Visitor v1 = new Visitor("Sim1", new Position(0, 0, 20));
            Visitor v2 = new Visitor("Sim2", new Position(5, 0, 45));
            //Create v1
            NetworkEventsDispatcher.getApplicationEventsDispatcher().fireVisitorCreatedEvent(new VisitorCreatedEvent(this, v1));
            //Create v2
            NetworkEventsDispatcher.getApplicationEventsDispatcher().fireVisitorCreatedEvent(new VisitorCreatedEvent(this, v2));

            Thread.sleep(5000);
            //Update v1
            v1.setRotation(90);
            NetworkEventsDispatcher.getApplicationEventsDispatcher().fireVisitorUpdatedEvent(new VisitorUpdatedEvent(this, v1));

//            //Delete v1
//            ApplicationEventsDispatcher.getApplicationEventsDispatcher().fireVisitorDeletedEvent(new VisitorDeletedEvent(this, v1));
//            //Delete v2
//            Thread.sleep(1000);
//            ApplicationEventsDispatcher.getApplicationEventsDispatcher().fireVisitorDeletedEvent(new VisitorDeletedEvent(this, v2));
        } catch (InterruptedException ex) {
            Logger.getLogger(EventsSimulator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }



    public EventsSimulator() {
        
    }

}
